package ThreadDemo;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-10-13
 * Time: 11:10
 */
public class Demo13 {
    //线程状态
    public static void main(String[] args) throws InterruptedException {
        Thread mainThread = Thread.currentThread();
        Thread thread = new Thread(() -> {
            for (int i = 0; i < 1000000000; i++) {
                System.out.println(mainThread.getState());
                System.out.println(Thread.currentThread().getState());
                System.out.println("hello,Thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
//                System.out.println("jjjj");
            }
        });

        System.out.println(thread.getState());

        thread.start();
        thread.join();

        System.out.println(thread.getState());

        System.out.println("main线程先结束");


    }
}
